package cn.com.api.mapper.base;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import cn.com.api.entity.ApiU_message;

//DAO
public interface U_messageMapperBase {

	// 根据id查看
	@Select("SELECT * FROM U_MESSAGE where id = #{id}")
	public ApiU_message findU_messageById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM U_message")
	public List<ApiU_message> findU_messages();

	// 根据条件查看数据集
	public List<Map<String, Object>> findU_messagesByMap(HashMap condition);

	// 添加
	@Insert("INSERT INTO U_MESSAGE (CONN_ID, TYPE, ADD_TIME, IS_READ, READ_TIME, USER_ID, TITLE, CONTENT, IMAGE, EXT1, EXT2, EXT3, EXT4, EXT5) VALUES (#{conn_id,jdbcType=NUMERIC}, #{type,jdbcType=NUMERIC}, #{add_time,jdbcType=VARCHAR}, #{is_read,jdbcType=NUMERIC}, #{read_time,jdbcType=VARCHAR}, #{user_id,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insertU_message(ApiU_message u_message);

	// 修改
	@Update("UPDATE U_MESSAGE SET  CONN_ID = #{conn_id}, TYPE = #{type}, ADD_TIME = #{add_time}, IS_READ = #{is_read}, READ_TIME = #{read_time}, USER_ID = #{user_id}, TITLE = #{title}, CONTENT = #{content}, IMAGE = #{image}, EXT1 = #{ext1}, EXT2 = #{ext2}, EXT3 = #{ext3}, EXT4 = #{ext4}, EXT5 = #{ext5} where ID = #{id}")
	public int updateU_message(ApiU_message u_message);

	// 删除
	@Delete("DELETE FROM U_MESSAGE where ID = #{id}")
	public int deleteU_message(Integer id);

	// Foreign keys revelant

	// region Indexs revelant

}
